package com.charley.icloud.admin.pojo.request;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

/**
 * 控制层请求参数
 * */
@Data
@Schema(name = "SysUserQuery")
public class SysUserQuery {

    @Schema(name = "id",description = "ID")
    private Long id;

    @Schema(name = "username",description = "用户名")
    @NotBlank(message = "用户名不能空")
    private String username;

    @Schema(name = "password",description = "密码")
    @NotBlank(message = "密码不能为空")
    private String password;

    @Schema(name = "nickName",description = "昵称")
    private String nickName;

    @Schema(name = "headImgUrl",description = "头像URL")
    private String headImgUrl;

    /**
     *  ^1[3-9]\d{9}$ 格式
     *  ^ 表示字符串的开始
     *  1 表示手机号的第一个数字是1
     *  [3-9] 表示第二个数字必须是3到9之间的任意数字
     *  \\d{9} 表示之后跟着9个数字，这九个数字是手机号的其余数字
     *  $ 表示字符串的结束
     * */
    @Schema(name = "phone",description = "手机号")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    private String phone;

    @Schema(name = "email",description = "邮箱")
    @Email
    private String email;

    @Schema(name = "sex",description = "性别")
    private Byte sex;

    @Schema(name = "type",description = "用户注册类型")
    private Byte type;

    @Schema(name = "level",description = "会员用户身份级别")
    private Byte level;
}
